﻿using Shop.RemoteModel;
using Shop.RemoteModel.AdvertPlace.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Api
{
    [ApiRouteName("/shop/advert/place/{name}")]
    internal class AdvertPlaceApi : ApiController
    {
        private readonly IAdvertPlaceService _Service;

        public AdvertPlaceApi ( IAdvertPlaceService service )
        {
            this._Service = service;
        }
        public PagingResult<AdvertPlaceDto> Query ( PagingParam<AdvertPlaceQueryParam> obj )
        {
            return this._Service.Query(obj);
        }
        public AdvertPlaceItem[] GetItems ( AdvertPlaceGetParam query )
        {
            return this._Service.GetItems(query);
        }
        public AdvertPlaceConfig GetConfig ( [NumValidate("shop.advert.place.id.error", 1)] long id )
        {
            return this._Service.GetConfig(id);
        }
        public long Add ( AdvertPlaceAdd data )
        {
            return this._Service.Add(data);
        }

        public void Delete ( [NumValidate("shop.advert.place.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }

        public AdvertPlace Get ( [NumValidate("shop.advert.place.id.error", 1)] long id )
        {
            return this._Service.Get(id);
        }
        public void Enable ( [NumValidate("shop.advert.place.id.error", 1)] long id )
        {
            this._Service.Enable(id);
        }
        public void Stop ( [NumValidate("shop.advert.place.id.error", 1)] long id )
        {
            this._Service.Stop(id);
        }
        public AdvertPlaceDto[] Gets ( AdvertPlaceStatus? status )
        {
            return this._Service.Gets(status);
        }
        public Dictionary<long, string> GetExampleImg ( [NullValidate("public.query.param.null")] string[] placeType )
        {
            return this._Service.GetExampleImg(placeType);
        }

        public bool Set ( LongParam<AdvertPlaceSet> param )
        {
            return this._Service.Set(param.Id, param.Value);
        }
    }
}
